/*
 * $Id$
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */
package org.mule.transport.jpa.config;

import org.mule.tck.junit4.FunctionalTestCase;
import org.mule.transport.jpa.JpaConnector;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
 * TODO
 */
public class JpaNamespaceHandlerTestCase extends FunctionalTestCase {
	@Override
	protected String getConfigResources() {
		return "jpa-namespace-config.xml";
	}

	@Test
	public void jpaConfig() throws Exception {
		JpaConnector c = (JpaConnector) muleContext.getRegistry().lookupConnector("jpaConnector");
		assertNotNull(c);
		assertTrue(c.isConnected());
		assertTrue(c.isStarted());
		assertEquals("select test from Test where test.property = :property", c.getQueries().get("myQuery"));
		assertEquals("select test from Test where test.property = #[header:testProperty]", c.getQueries().get("myQueryDynamic"));
	}
}
